import React, { Component } from 'react'

export default class Child extends Component {
  render() {
    return <div>Child</div>
  }
  componentDidMount() {
    // 初始化定时器，把定时器句柄存起来
    this.timer = setInterval(() => {
      console.log(1)
    }, 1000)
  }
  componentWillUnmount() {
    console.log('Child componentWillUnmount')
    // 清理定时器
    // 解绑事件
    clearInterval(this.timer)
  }
}
